home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / SYMBMATH.H31 < prev    next >
Text File  |  1994-03-29  |  4KB  |  114 lines

  1.             4. Examples
  2.  
  3.     In the following examples, a line of "IN: " means input, which 
  4. you type in the Input window, then leave the Input window by pressing 
  5. <Esc>, finally run the program by the command "Run"; while a line of 
  6. "OUT: " means output. You will see both input and output are displayed 
  7. on two lines with beginning of "IN: " and "OUT: " in the Output window.
  8. You should not type the word "IN: ". Some outputs may be omitted on the
  9. examples. # is a comment statement. 
  10.     You can split a line of command into multi-lines of command by
  11. the comma ,. The comma without any blank space must be the last character
  12. in the line.
  13.     Note that you should not be suprised if some functions in the 
  14. following examples are not working when their libraries are not in the 
  15. default directory or missing.
  16.  
  17.             4.1 Calculation
  18.  
  19.     SymbMath gives the exact value of calculation when the switch
  20. numeric := off (default), or the approximate value of numeric
  21. calculation when the switch numeric := on or by num().
  22.     Mathematical functions are usually not evaluated until by
  23. num() or by setting numeric := on.
  24.     SymbMath can manipulate units as well as numbers, be used as 
  25. a symbolic calculator, and do exact computation. The range of real 
  26. numbers is from -infinity to +infinity, e.g. ln(-inf), exp(inf+pi*i), 
  27. etc. SymbMath contains many algorithms for performing numeric
  28. calculations. e.g. ln(-9), i^i, (-2.3)^(-3.2), 2^3^4^5^6^7^8^9, etc.
  29.     Note that SymbMath only gives a principle value if there
  30. are multi-values, except for the solve() and root().
  31.     
  32.     Example 4.1.1.
  33. exact and numeric calculations of 1/2 + 1/3.
  34.  
  35. IN:  1/2+1/3         # exact calculation
  36. OUT: 5/6
  37. IN:  num(1/2+1/3)    # numeric calculation
  38. OUT: 0.8333333333
  39.  
  40.     Evaluate the value of the function f(x) at x=x0 by f(x0).
  41.     Example 4.1.2. 
  42. evaluate sin(x) when x=pi, x=180 degree, x=i.
  43.  
  44. IN:  sin(pi), sin(180*degree)
  45. OUT: 0, 0
  46. IN:  sin(i), num(sin(i))
  47. OUT: sin(i), 1.175201 i
  48.  
  49.     Example 4.1.3. 
  50. Set the units converter from the minute to the second, then calculate 
  51. numbers with different units.
  52.  
  53. IN:  minute:=60*second
  54. IN:  v:=2*meter/second
  55. IN:  t:=2*minute
  56. IN:  d0:=10*meter
  57. IN:  v*t+d0
  58. OUT: 250 meter
  59.  
  60.     Evaluate the expression value by
  61.         subs(y, x = x0)
  62.     Example 4.1.4. 
  63. evaluate z=x^2 when x=3 and y=4.
  64.  
  65. IN:  z:=x^2                   # assign x^2 to z
  66. IN:  subs(z, x = 3)           # evaluate z when x = 3
  67. OUT: 9
  68. IN:  x:=4                     # assign 4 to x
  69. IN:  z                        # evaluate z 
  70. OUT: 16
  71.  
  72.     Note that after assignment of x by x:=4, x should be cleared from
  73. assignment by clear(x) before differentiation (or integration) of the 
  74. function of x. Otherwise the x values still is 4 until new values 
  75. assigned. If evaluating z by the subs(), the variable x is
  76. automatically cleared after evaluation, i.e. the variable x in subs()
  77. is local variable. The operation by assignment is global while the
  78. operation by internal function is local, but operation by external function
  79. is global. This rule also applies to other operations. 
  80.     The complex numbers, complex infinity, and most math functions 
  81. with the complex arguement can be calculated.
  82.  
  83.     Example 4.1.5.
  84. IN:  sign(1+i), sign(-1-i), i^2
  85. OUT: 1, -1, -1
  86.  
  87.     Example 4.1.6.
  88. IN:  exp(inf+pi*i)
  89. OUT: -inf
  90. IN:  ln(last)
  91. OUT: inf + pi*i
  92.  
  93.     The built-in constants (e.g. inf, zero, discont, undefined) can
  94. be used as numbers in calculation of expressions or functions.
  95.                 
  96.                 4.1.1   Discontinuity and one-sided value
  97.         Some math functions are discontinuous at x=x0, and only have
  98. one-sided function value. If the function f(x0) gives the discont as its
  99. function value, you can get its one-sided function value by f(x0-zero)
  100. or f(x0+zero).
  101.  
  102.     Example 4.1.7.
  103. IN:  f(x_) := exp(1/x)      # define function f(x)
  104. IN:  f(0)                   
  105. OUT: discont                # discontinuity at x=0
  106. IN:  f(0-zero)              # left-sided value at x=0-
  107. OUT: 0                      
  108. IN:  f(0+zero)              # right-sided value at x=0+
  109. OUT: inf                    
  110.  
  111.                 4.1.2  Undefined and indeterminate form
  112.         If the function value is undefined, it may be indetermate form
  113. (e.g. 0/0, inf/inf), you can evaluate it by lim() (see Chapter 4.4 Limits).
  114.